
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart';

class AnimatedLogo extends AnimatedWidget {
  const AnimatedLogo({Key? key, required Animation<double> animation})
      : super(key: key, listenable: animation);

  @override
  Widget build(BuildContext context) {
    final Animation<double> animation = listenable as Animation<double>;
    return  Center(
      child:  Container(
        margin:  const EdgeInsets.symmetric(vertical: 10.0),
        height: animation.value,
        width: animation.value,
        child:  const FlutterLogo(),
      ),
    );
  }
}

class LogoApp extends StatefulWidget {
  const LogoApp({Key? key}) : super(key: key);

  @override
  _LogoAppState createState() =>  _LogoAppState();
}

class _LogoAppState extends State<LogoApp> with SingleTickerProviderStateMixin {
  late AnimationController controller;
  late Animation<double> animation;

  @override
  initState() {
    super.initState();
    controller =  AnimationController(
        duration: const Duration(milliseconds: 2000), vsync: this);
    animation =  Tween(begin: 0.0, end: 300.0).animate(controller);
    controller.forward();
  }

  @override
  Widget build(BuildContext context) {
    return  AnimatedLogo(animation: animation);
  }

  @override
  dispose() {
    controller.dispose();
    super.dispose();
  }
}

void main() {
  runApp( const LogoApp());
}
